import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class JDText extends StatefulWidget {
  final String text;

  final bool password;

  final void Function(Object val)? cb;

  const JDText({super.key, this.text="请输入内容", this.password = false, this.cb});

  @override
  State<JDText> createState() => _JDTextState();
}

class _JDTextState extends State<JDText> {
  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context, designSize: const Size(750, 1334));

    return Container(
      height: 72.h,
      decoration: const BoxDecoration(
          // color: Colors.black12,
          // borderRadius: BorderRadius.circular(20)
          border: Border(bottom: BorderSide(width: 1, color: Colors.black12))),
      child: TextField(
        autofocus: false,
        obscureText: widget.password,
        decoration: InputDecoration(
          hintText: widget.text,
          border: OutlineInputBorder(
              borderSide: BorderSide.none,
              borderRadius: BorderRadius.circular(30))),
        onChanged: widget!.cb,
      ),
    );
  }
}
